Skip to content

Allow whitelisting stream wrappers in File::prohibitWrappers() (#4881)#4884

Closed
YoussefMansour9 wants to merge 1 commit into
PHPOffice:masterfrom
YoussefMansour9:fix/allow-stream-wrappers
Closed

Allow whitelisting stream wrappers in File::prohibitWrappers() (#4881)#4884
YoussefMansour9 wants to merge 1 commit into
PHPOffice:masterfrom
YoussefMansour9:fix/allow-stream-wrappers

Conversation

@YoussefMansour9
Copy link
Copy Markdown

Fixes #4881

The prohibitWrappers() method was added as part of a security advisory but is too strict: it blocks all stream wrappers with multi-character schemes, including legitimate ones like vfs:// used by the vfsStream testing library.

This adds File::allowStreamWrappers(["vfs"]) to selectively whitelist specific wrappers. The existing default behavior (blocking all multi-character schemes) is preserved.

The prohibitWrappers() method was added as part of a security advisory but is too strict: it blocks all stream wrappers with multi-character schemes, including legitimate ones like vfs:// used by the vfsStream testing library.

This adds an allowStreamWrappers() method to whitelist specific wrappers, and modifies prohibitWrappers() to skip blocked schemes only when they are not in the allowed list.
@YoussefMansour9 YoussefMansour9 force-pushed the fix/allow-stream-wrappers branch from 34c9286 to 1b28e3c Compare May 23, 2026 20:41
@oleibman
Copy link
Copy Markdown
Collaborator

Thank you for submitting this. I encourage you to continue to look for outstanding issues which you can solve. Unfortunately, both of the issues which you have chosen to address today come with complications - one has security implications, and one involves a potential breaking change. For those reasons, I need to reject them both. I truly hope this will not be overly discouraging for you.

@oleibman oleibman closed this May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

prohibitWrappers() breaks testing with mikey179/vfsstream — no way to whitelist custom stream wrapper

2 participants